{% extends 'base.html' %}

{# 页面标题 #}
{% block title %}我的网站{% endblock %}
{% block nav_file_center %}active{% endblock %}


{# 加载css样式 #}
{% load staticfiles %}

{% block header_extends %}
{% endblock %}

{# 页面内容 #}
{% block content %}
<div class="container">
    <div class="row">
        <div class="col-sm-12">
            <div class="panel panel-default">
                <div class="panel-heading">文件列表</div>
                <div class="panel-body">
                    <table class="table table-bordered">
                        <thead>
                            <tr>
                                <th>#</th>
                                <th>文件名称</th>
                                <th>文件内容</th>
                                <th>上传时间</th>
                                <th>下载</th>
                            </tr>
                        </thead>
                        <tbody>
                            {% for file in files %}
                                <tr>
                                    <th scope="row">{{ file.pk }}</th>
                                    <td>{{ file.title }}</td>
                                    <td>{{ file.file }}</td>
                                    <td>{{ file.upload_time | date:"Y-m-d"  }}</td>
                                    <td><button onclick="window.location.href='{{ file.file.url }}'">download</button></td>
                                </tr>
                            {% empty %}
                                <h3>暂时没有分享的文件~</h3>
                            {% endfor %}
                        </tbody>
                    </table>        
                </div>
            </div>

        </div>
    </div>
</div>
{% endblock %}